<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateLogsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('logs', function(Blueprint $table)
		{
			$table->bigInteger('id', true)->unsigned();
			$table->string('group')->index('group_index')->comment('分组');
			$table->char('type', 32)->index('type_index')->comment('类型');
			$table->string('account', 64)->index('account_index')->comment('用户名');
			$table->string('browser', 128)->comment('浏览器');
			$table->string('host', 128)->comment('Host');
			$table->string('uri', 128)->comment('Uri');
			$table->string('method', 128)->comment('Method');
			$table->string('model', 128);
			$table->string('ip', 32)->comment('IP');
			$table->string('location', 128)->comment('地址');
			$table->text('user_agent', 65535)->comment('UserAgent');
			$table->text('description', 65535)->comment('操作内容');
			$table->text('data', 65535)->comment('数据');
			$table->integer('user_id')->unsigned()->index('user_id_index');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('logs');
	}

}
